package com.cbank.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import com.cbank.domain.Industry;
@Repository
public interface IndustryDao {
	String ALL = "id,name,type,parent_id,status,update_time,create_time";

	@Select("select " + ALL + " from industry where id = #{id} and status = 1 limit 1")
    Industry getById(Long id);
	
	@Select("select " + ALL + " from industry where status = 1 order by create_time DESC limit #{index},#{offset}")
    List<Industry> getPage(@Param(value = "index") int index, @Param(value = "offset") int offset);
	
	@Select("select " + ALL + " from industry where status = 1 order by create_time DESC limit #{index},#{offset}")
    List<Industry> getPageWithParam(@Param(value = "index") int index, @Param(value = "offset") int offset);
	
	@Select("select count(1) from industry where status = 1")
    int getCount();
}
